import { createWebHashHistory, createRouter } from 'vue-router'

import PhotoAlbum from '@/components/PhotoAlbum'
import Index from '@/pages/index/index.vue'
const routes = [
  { path: '/login', component: PhotoAlbum },
  { path: '/', component: Index },
  { path: '/upload', component: () => import('@/pages/upload/index.vue') },
]

export const router = createRouter({
  history: createWebHashHistory(),
  routes,
})
export const toPage = (data, type = 'push') => {
  if (typeof data === 'number') {
    router.go(data)
  }
  router[type](data)
}
export default router
